package com.lmx.persistence.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.lmx.repoDomain.tmodel.DicttypeTenant;

@Service
@Scope("prototype")
public class DicttypeTenantService {
	private Log logger = LogFactory.getLog(this.getClass());

	@PersistenceContext
	private EntityManager em;

	/**
	 * 获取租户字典表
	 * 
	 * @author ytche
	 * @return
	 * @date 2017年4月6日 下午5:13:15
	 */
	public List<DicttypeTenant> findByTenantId(Long tenantId) {
		String query = "select dt from DicttypeTenant dt where tenant.id= ?1 and delStatus =0";
		return this.em.createQuery(query).setParameter(1, tenantId).getResultList();
	}
}
